﻿using Kevin.Shop.Business.Service.Entity.Helper;
using Kevin.Shop.Business.Service.Entity.SalesManagement.Promotion;
using RiderShop.Mobile.Common.Component;
using RiderShop.Mobile.Modle.Home;
using RiderShop.Mobile.Modle.Product;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;

namespace RiderShop.Mobile.Controllers
{
    public partial class ProductController : ThemeController
    {
        /// <summary>
        /// 得到立夏的广告位
        /// </summary>
        /// <returns>得到立夏的广告位</returns>
        [HttpGet]
        public ActionResult SummerAdv()
        {

            //不继承母版页
            return View("~/Themes/" + WebClientContext.Current.SiteTheme + "/Views/Product/SummerAdv.cshtml", new IndexViewModel());
        }

        #region Get Summer Product List
        /// <summary>
        /// 得到立夏的产品(产品目前是静态的，以后改成动态的)
        /// </summary>
        /// <param name="pageIndex">当前页索引</param>
        /// <returns>得到立夏的产品</returns>
        [HttpGet]
        public ActionResult SummerProduct(int pageIndex = 0)
        {
            var model = ProductListModel.GetPresellProducts();

            //不继承母版页
            return View("~/Themes/" + WebClientContext.Current.SiteTheme + "/Views/Product/SummerProduct.cshtml", model);
        }

        /// <summary>
        /// 异步得到得到立夏的产品(看需求，分页的话就得用到此方法)
        /// </summary>
        /// <param name="pageIndex">当前页索引</param>
        /// <returns>得到立夏的产品</returns>
        [HttpGet]
        public JsonResult SummerProductByAjaxRequest(int pageIndex = 0)
        {
            var model = new ProductListModel();
            var query = new GroupBuyProductQuery()
            {
                PageIndex = pageIndex,
                PageSize = 30
            };
            model.GetSpecialPriceProducts(query);

            return Json(model.Result.Data, JsonRequestBehavior.AllowGet);
        }
        #endregion
    }
}
